package com.forekenow.Demo12;

import java.io.*;

public class BufferedDemo {
    public static void main(String[] args) {
        try {
            //创建一个节点流
            FileReader fr = new FileReader("IODemo.java");
            //创建一个BufferedReader处理流
            BufferedReader br = new BufferedReader(fr);

            FileWriter fw = new FileWriter("IODemo_new.java");
            BufferedWriter bw = new BufferedWriter(fw);

            //读取源文件中的一行
            String line = br.readLine();
            while (line!=null){
                bw.write(line);
                bw.newLine();//换行
                //读取下一行
                line = br.readLine();
            }
            //释放资源
            bw.close();
            br.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }

}
//    XWW xww = new XWW(); //初始化要写入文件的
//xww.write(randomAccessFile);